package com.wyc.example.common;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 王韫琛
 * @version 1.0
 * @date 2021/5/23 0:59
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

   /**
    * @Author 王韫琛
    * @Description //用来配置跨域
    * @Date 8:12 2021/5/23
    * @Param [registry]
    * @return void
    **/
   @Override
   public void addCorsMappings(CorsRegistry registry) {
       registry.addMapping("/**")
               .allowedOriginPatterns("*")
               .allowCredentials(true)
               .allowedMethods("GET", "POST", "DELETE", "PUT", "PATCH")
               .maxAge(3600);
   }

}
